package com.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import com.service.UploadFileService;
import com.utils.UploadUtils;

@Service
public class UploadFileServiceImpl implements UploadFileService{

	@Value("${img.upload.path}")
	private String imgUploadPath;
	@Value("${img.access.path}")
	private String imgAccessPath;
	
	@Override
	public String uploadFile(MultipartFile[] imgfiles) {
		// TODO Auto-generated method stub
		try {
			List<String> imgs = UploadUtils.uploadQiniuImg(imgfiles, imgUploadPath, imgAccessPath);
			if(imgs!=null && imgs.size()>0) {
				return imgs.get(0);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
